package javacore.fundamentals;

import javacore.fundamentals.accessmodifier.defau.AllDefault;
import javacore.fundamentals.accessmodifier.priv.AllPrivate;
import javacore.fundamentals.accessmodifier.protct.AllProtected;
import javacore.fundamentals.accessmodifier.pub.AllPublic;

class SubClass extends AllDefault{

	public SubClass(String name, double money) {
		super(name, money);
		name = "";
	}
	
}

class SubClass2 extends AllProtected{

	public SubClass2(String name, double money) {
		super(name, money);
		name = "";
		printInfo();
	}
	
}


public class TryingAccess {
	public static void main(String[] args) {
		// i can access nothing on this class
		AllPrivate aprivate = new AllPrivate("Private", 100d);
		
		// i cann't access because i'm not in the same package
		AllProtected aprotect = new AllProtected("Protect", 200d);
		
		// i cann't access because i'm not in the same package
		AllDefault adefau = new AllDefault("Default", 12);
		
		
		// i can access anything although i'm not in the same package because he is PUBLIC
		AllPublic apub = new AllPublic("Public", 1d);
		System.out.println("I can access your info from far: " + "" + apub.money + " " + apub.name);
		apub.printInfo();
	}
}
